package InterviewPractise;

import java.awt.*;

/**
 * Created by richard on 5/5/14.
 */
public class PrintTwoDeminsionArrayDiagonal {
    public static void main(String[] args){
        int[][] numbers = {{ 1, 2, 3, 4 },
        { 5, 6, 7, 8 },
        { 9, 10, 11, 12 },
        { 13, 14, 15, 16 }};

        PrintTwoDeminsionArrayDiagonal printTwoDeminsionArrayDiagonal = new PrintTwoDeminsionArrayDiagonal();
        printTwoDeminsionArrayDiagonal.print(numbers);

    }

    public void print(int[][] numbers){
        int w = numbers[1].length;
        int l = numbers.length;
        for(int iw=0, il=0;iw<w;iw++,il++){
            if(iw==0&&il==0){
                System.out.print(numbers[iw][il]);
                System.out.println();
                continue;
            }
            for(il=0;il<=iw;il++){
                System.out.print(numbers[iw-il][il]);
            }
            System.out.println();
        }
    }
}
